package com.secxiot.consumer.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.secxiot.common.entity.ResultVo;
import com.secxiot.consumer.user.feign.UserClient;
import com.secxiot.provider.user.dto.BindDto;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(tags = "扫码绑定模块")
@RequestMapping("/bind")
@RestController
public class BindController {

    @Autowired
    private UserClient userClient;

    @ApiOperation(value = "扫码绑定关系")
    @PostMapping
    public ResultVo<Integer> bindUserRel(@RequestBody BindDto bindDto) {
        Integer integer = userClient.bindUserRel(bindDto);
        return new ResultVo<Integer>(integer);
    }

    /*@ApiOperation(value = "扫码查看信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "被扫码用户id",required = true, paramType = "query"),
    })
    @GetMapping("/id")
    public ResultVo<UserVo> getUser(@RequestParam(value = "userId", required = true) Long userId){
        UserDo user = userClient.getUser(userId);
        UserVo userVo = new UserVo();
        BeanUtils.copyProperties(user,userVo);
        return new ResultVo<>(userVo);
    }*/
}
